package top.timestreet.xmsk.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author TateLiao
 * @data 2019年6月3日 处理章节日期，统一格式化成yyyy年MM月dd日
 */
public class ChapterLastUpdateTimeUtil {

	/**
	 * "5/16/2019 7:07:11 PM"
	 * @param lastUpdateTime
	 * @return
	 */
	public static String quFormat(String lastUpdateTime) {
		Date date = null;
		String result = "";
		if (lastUpdateTime.contains("AM")) {
			result = lastUpdateTime.substring(0, lastUpdateTime.indexOf("AM"));
		}
		if (lastUpdateTime.contains("PM")) {
			result = lastUpdateTime.substring(0, lastUpdateTime.indexOf("PM"));
		}
		result = lastUpdateTime.substring(0, lastUpdateTime.indexOf(" "));
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy");
		SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy年MM月dd日");
		try {
			date = simpleDateFormat.parse(result);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return simpleDateFormat2.format(date);
	}

}
